<template>
  <div id='DetailInfo' v-if="Object.keys(detailinfo).length !== 0">
    <img :src="item" alt="" v-for="item in detailinfo.detailImage[0].list" @load="imgload">
  </div>
</template>

<script>
  export default {
    name: 'DetailInfo',
    data() {
      return {
        count: 0,
        imglength: 0
      }
    },

    props: {
      detailinfo: {
        type: Object,
        default() { }
      }
    },
    components: {},
    methods: {
      imgload() {
        if (++this.count === this.imglength) {
          this.$emit('imgload')
        }
      }
    },
    watch: {
      detailinfo() {
        this.imglength = this.detailinfo.detailImage[0].list.length
      }

    }
  }
</script>

<style scoped>
  #DetailInfo img {
    width: 100%;
  }
</style>